package com.last1mile.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.last1mile.model.Serve;
import com.last1mile.pojo.MerServeDO;

@Service
public interface ServeService {

    /**
     * 卖家创建服务
     * 
     * @param serve
     */
    public void createMerServe(Serve serve);

    /**
     * 创建买家关注卖家的某个服务
     * 
     * @param perId
     * @param merId
     * @param serveId
     */
    public void createSubscribe(Integer perId, Integer merId, Integer serveId);

    /**
     * 查询卖家发布的所有服务
     * 
     * @param merId
     * @return
     */
    public List<MerServeDO> queryServesByMerId(Integer merId);

    public List<MerServeDO> queryServeByAddrExceptUser(String addrCountry, String addrState, String addrCity,
                                                       String addrDistrict, Integer merId);

    /**
     * 根据ID查询某个服务
     * 
     * @param serveId
     * @return
     */
    public MerServeDO queryServeById(Integer serveId);
    
    /**
     * 查询买家关注的所有服务
     * @param perId
     * @return
     */
    public List<MerServeDO> queryServesByPerId(Integer perId);

    /**
     * 查询买家是否存在关注卖家某个服务的记录
     * 
     * @param perId
     * @param merId
     * @param serveId
     * @return
     */
    public Integer countSubscribe(Integer perId, Integer merId, Integer serveId);

    /**
     * 查询买家关注的服务数
     * 
     * @param perId
     * @return
     */
    public Integer countPerSubscribe(Integer perId);

    /**
     * 查询某个卖家被关注的次数(以服务为单位)
     * 
     * @param merId
     * @return
     */
    public Integer countMerBeSubscribed(Integer merId);

    /**
     * 查询某个服务被关注的次数
     * 
     * @param serveId
     * @return
     */
    public Integer countServeBeSubscribed(Integer serveId);
}
